<template>
  <view>
    <a-spin :spinning="loading">
      <el-table :data="tableData" height="60vh" ref="table">
        <el-table-column label="井深(m)" prop="depth" />
        <el-table-column label="井斜角(°)" prop="inclination" />
        <el-table-column label="方位角(°)" prop="azimuth" />
        <!-- <el-table-column fixed="right" label="操作" width="80">
          <template #default>
            <el-button style="color: red;" type="text" size="small">删除</el-button> </template>
        </el-table-column> -->
      </el-table>
      <!-- <EleZh>
        <el-pagination v-show="true" :total="allData.length" layout="total, prev, pager, next,sizes" :pager-count="3"
        v-model:current-page="queryParams.pageNum" v-model:page-size="queryParams.pageSize" @current-change="getList"
        @size-change="handlesizechange" />
      </EleZh> -->
      <AntdZh>
        <a-pagination
          v-model:current="queryParams.pageNum"
          v-model:pageSize="queryParams.pageSize"
          :total="allData.length"
          show-quick-jumper
          @change="getList"
        />
      </AntdZh>
    </a-spin>
  </view>
</template>
<script setup>
import { queryOne } from "@/api/survey/survey.js";
const allData = ref([]);
const loading = ref(false);
const queryParams = ref({
  pageSize: 100,
  pageNum: 1,
});
const props = defineProps({
  value: {
    type: String,
  },
});
watch(
  () => props.value,
  () => {
    console.log("watch", props.value);
    getList();
  }
);
// 查询数据
function getList() {
  if (props.value) {
    loading.value = true;
    queryOne(props.value).then((res) => {
      //console.log(res)
      allData.value = res;
      loading.value = false;
    });
  }
}
const tableData = computed(() => {
  return allData.value.slice(
    (queryParams.value.pageNum - 1) * queryParams.value.pageSize,
    queryParams.value.pageSize * queryParams.value.pageNum
  );
});
getList();
</script>
